package com.mhz.mvc.fc;

import java.util.LinkedList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mhz.interceptor.Interceptor;


/**
 * 控制器代理
 * @author mhz
 *
 */
public class ActionProxy implements Action {
	
	private Action action;
	
	private ValueStack vs;

	private LinkedList<Interceptor> interceptorStack = new LinkedList<Interceptor>();

	public String execute() throws Exception {
		vs.push(action);
		for (Interceptor in : interceptorStack) {
			in.execute();
		}
		return action.execute();
	}
	public ActionProxy(Action action, ValueStack vs) {
		this.action = action;
		this.vs = vs;
	}
	public void pushInterceptor(Interceptor interceptor) {
		interceptorStack.push(interceptor);
	}

}
